package com.lianxueda.drawing.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lianxueda.drawing.domain.pojo.WxUser;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * @author 29264
 */
@Mapper
public interface WxUserMapper extends BaseMapper<WxUser> {
    Integer selectIdByName(String parentName);

    @Select("SELECT COUNT(*) > 0 FROM users WHERE openid = #{openId}")
    boolean existsByOpenId(String openId);

    @Select("SELECT * FROM users WHERE openid = #{openid}")
    WxUser findByOpenId(String openid);

    String selectNicknameByPhone(String parentPhone);

    @Select("SELECT nickname FROM users WHERE studentId = #{studentId}")
    String findParentNameById(@Param("studentId")  Integer studentId);


    List<Map<String, Object>> getOpenIdByStudentIds(@Param("studentId") List<Integer> studentId);
}
